package com.zds.support.api.resp

import android.text.TextUtils
import com.google.gson.annotations.SerializedName
import java.io.Serializable

class UserResp() : Serializable {
    companion object {
        const val DEFAULT_REG_TIME = 1451577601000
    }

    var id: Int = 0
    var mobile: String = ""

    @SerializedName("nickName", alternate = arrayOf("nickname"))
    var nickname: String = ""
    var sex: Int = 0

    //var age: Int = 0
    var height: Int = 0
    var weight: Int = 0
    var photo: String = ""
    var birthday: Long = 0
    var heartBeatThreshold: Int = 0
    var powerThreshold: Int = 0
    var token: String = ""
    var sensorDevice: String = ""  // 传感器名称
    var sensorMac: String = ""  // 传感器mac地址
    var heartRateBelt: String = "" //  心率带名称
    var heartRateMac: String = "" // 心率带mac地址
    var sn: String = "" // sn
    var bmi: Double = 0.0
    var bfr: Double = 0.0
    var wt: Double = 0.00
    var heightUnit = "cm"
    var wtUnit = "kg"
    var regTime: Long = DEFAULT_REG_TIME// 注册时间
    var vipExpireDate: Long = 0// 注册时间
    var thisWeekTotalCalorie: Double = 0.0 // 本周总卡路里
    var thisWeekTotalDistance: Double = 0.0 //本周总距离
    var thisWeekTrainingSeonds: Long = 0//  本周训练总时长(秒)
    var thisWeekTrainingTimes: Int = 0//  本周训练次数
    var totalCalorie: Double = 0.0 //训练总卡路里
    var totalDistance: Double = 0.0 //训练总距离
    var totalPoint: Double = 0.0 //总野豆
    var trainingSeconds: Long = 0// 训练总时长(秒)
    var trainingTimes: Int = 0// 训练总次数
    var currentConDays: Int = 0 //  当前连续骑行天数
    var maxConDays: Int = 0 //   历史最大连续骑行天数
    var maxDistance: Double = 0.0 //   最大距离
    var totalTrainingDays: Int = 0 //   总骑行天数
    var isVip: Int = 0 //   是否是会员
    var powerThresholdDefault: Int = 0  //
    var heartThresholdDefault: Int = 0

    /**
     * 用户喜欢的运动强度
     * 默认值为 BEGINNER
     * LOW IMPACT 1 选择Y1、Y2的往期课
     * BEGINNER  2 选择Y3的往期课
     * INTERMEDIATE 3 选择Y4的往期课
     * ADVANCED 4 选择Y5的往期课
     */
    var favoriteExerciseIntensity: Int = 0//

    // var lastWeeksTrainingDays  : Int = 0 //   最近周骑行天数 ,
    var badges = 0
    var userBannerTxt = ""
    var email = ""
    var userType: Int = 0 //  用户类型：0=普通用户,1=vip会员，2=试看会员
    var userClickMedal = false
    var userId = 0
    var addPoints = 0//本周获得野豆
    var goodThingSize = 0//用户好物碎片总数
    var couponSize = 0//用户优惠卷总数

    var isFreeWatchTimeOutRemind: Int = 0 // 1 ,则进行续费提醒，提醒后，缓存本地不再提醒（如果 freeWatchDeadlineTime 字段发生变化，则需要再次提醒
    var freeWatchDeadlineTime: Long = 0
    var freeWatchRechargeAcTime: Long = 0 // 充值活动截至日期
    var actualIncreaseVipDay: Int = 0 // v4.6.0 新增 用于返回实际获取的Vip天数

    // false=用户信息未完善（转基础信息页）  true=用户信息已完善（转主页）


    fun getLoginType(): Int {//0通过，1从头，2sn
        return when {
            TextUtils.isEmpty(nickname) || height == 0 || wt == 0.0 -> {
                1
            }
            TextUtils.isEmpty(sn) -> {
                2
            }
            else -> {
                0
            }
        }
    }


    fun isPowerThresholdDefault(): Boolean {
        return powerThresholdDefault == 1
    }

    /**
     * 获取等级文本
     */
    fun getPowerThresholdText(): String {
        return when (powerThreshold) {
            in 0..100 -> "初级"
            in 1..150 -> "中级"
            in 151..200 -> "高级"
            in 201..250 -> "顶级"
            else -> "超凡"
        }
    }

    fun isHeartThresholdDefault(): Boolean {
        return heartThresholdDefault == 1
    }

    fun isMale(): Boolean { //2.2.6改：男性或者其他 都算男性 影响功率值相关计算
        return sex == 0 || sex ==2
    }
    fun isOther(): Boolean {
        return sex == 2
    }

    fun isVip(): Boolean {
        return isVip == 1
    }

    fun getUserAvatar(): String {
        return photo;
    }


}